<ul id="myTab" class="nav nav-tabs" style="margin-bottom:0;">
    <li class="<?php if(!$selected_tab) echo 'active'; ?>"><a href="#rights_overview" data-toggle="tab">Rechteübersicht</a></li>
    <li class="<?php if($selected_tab) echo 'active'; ?>"><a href="#rights_nav" data-toggle="tab">Navigationselemente</a></li>
</ul>
<div id="myTabContent" class="tab-content" style="border: 1px solid #DDD; border-top:none; padding:10px; background: #FFF;">
    <div class="tab-pane fade <?php if(!$selected_tab) echo 'active in'; ?>" id="rights_overview">
        <?php echo $this->table->generate(); ?>
    </div>
    <div class="tab-pane fade <?php if($selected_tab) echo 'active in'; ?>" id="rights_nav">
        <?php foreach ($roles as $role): ?>
            <div style="float:left; width:45%; margin:10px;">
                <h5><?php echo $role->name; ?></h5>

                <?php $items = $role->navitem(); ?>
                <table class="table table-condensed table-mini table-striped table-bordered">
                    <tr>
                        <th>Beschriftung</th>
                        <th>Controller</th>
                        <th>Function</th>
                        <th>Priorität</th>
                        <th><i class="icon-eye-open"></i></th>
                    </tr>
                    <?php foreach ($items as $item): ?>
                        <tr>
                            <td><?php echo $item->name; ?></td>
                            <td><?php echo $item->controller; ?></td>
                            <td><?php echo $item->function; ?></td>
                            <td><?php echo $item->priority; ?></td>
                            <td><?php echo $item->menu; ?></td>
                        </tr>
                    <?php endforeach; ?>
                </table>
            </div>
        <?php endforeach; ?>
        
        <br style="clear:both;">
        
        <?php echo form_button('show_form', 'Neues Element hinzufügen', 'class="btn btn-primary" id="show_form"'); ?>
        
        <fieldset id="new_nav_item">
            <legend>Neues Navigationselement hinzufügen</legend>
            <?php echo form_open('userrights/add_new'); ?>
            <table>
                <tr>
                    <td>Zuordnung an Rolle</td>
                    <td><?php echo form_dropdown('roletype', $roles_array, set_value('roletype')); ?></td>
                </tr>
                <tr><td>Beschriftung</td>
                    <td><?php echo form_input('label', set_value('label')); ?></td>
                </tr>
                <tr><td>Controller</td><td><?php echo form_input('controller', set_value('controller')); ?></td></tr>
                <tr><td>Function</td><td><?php echo form_input('function', set_value('function')); ?></td></tr>
                <tr><td>Priorität</td><td><?php echo form_input('prio', set_value('prio')); ?></td></tr>
                <tr><td>Sichtbar</td><td><input type="checkbox" checked="checked" name="visible"></td></tr>
            </table>
            <span style="color:red">
                <?php echo validation_errors(); ?>
            </span>
            <?php echo form_submit('', 'Speichern', 'class="btn btn-small"'); ?>
            <?php echo form_close(); ?>
            
        </fieldset>
        
        
    </div>
</div>
